package org.wyjc.action;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.wyjc.entity.AreaDTO;
import org.wyjc.entity.CityDTO;
import org.wyjc.entity.ProvinceDTO;
import org.wyjc.gap.CssSelector;
import org.wyjc.gap.Gap;
import org.wyjc.service.AreaService;
import org.wyjc.util.JsonUtil;

import com.opensymphony.xwork2.ActionSupport;

/**
 * 鐢ㄦ埛绠＄悊
 * 
 * @author chenying
 * 
 */
public class GapAction extends ActionSupport {

	private static final long serialVersionUID = 1L;
	@Resource
	private AreaService areaService;
	private String content;
	private String resultStr;
	private String selectionText;

	public String getSelectionText() {
		return selectionText;
	}

	public void setSelectionText(String selectionText) {
		this.selectionText = selectionText;
	}

	public String getResultStr() {
		return resultStr;
	}

	public void setResultStr(String resultStr) {
		this.resultStr = resultStr;
	}

	public AreaService getAreaService() {
		return areaService;
	}

	public void setAreaService(AreaService areaService) {
		this.areaService = areaService;
	}

	public String getContent() {
		return content;
	}

	public void setContent(String content) {
		this.content = content;
	}

	public String getHtmlList() {
		Gap gap=new Gap();
		List<CssSelector> list=gap.parseContent(content);
		//Map<String,List<CssSelector>> m=gap.elements(content,selectionText);
		System.out.println("++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++");
		Map map = new HashMap();
		map.put("map", list);
		this.resultStr = JsonUtil.returnDefaultAjax(map);
		return "json";
	}

}
